<%-- 
    Document   : bugDetail
    Created on : 12.5.2009, 13:17:13
    Author     : Ediczech
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <%@include file="view/header.jsp" %>

    <%-- Content --%>

    <a4j:form id="updateBug" prependId="">
            <p class="top"><h:outputText value="Bug ##{BugDetailBean.bug.id}: "/></p><br/>
            <h2><h:outputText value="#{BugDetailBean.bug.title}"/></h2>
            <h:panelGrid columns="2">
                <h:outputText value="#{msg.bug_project}:"/>
                <h:outputText value="#{BugDetailBean.bug.project.name} "/>

                <h:outputText value="#{msg.bug_finder}:"/>
                <h:outputText value="#{BugDetailBean.bug.finder.nick} "/>

                <h:outputText value="#{msg.bug_importance}:"/>
                <h:panelGroup rendered="#{!BugDetailBean.isBugProjectDeveloper}">
                    <h:outputText value="#{BugDetailBean.bug.importance.name} "/>
                </h:panelGroup>
                <h:panelGroup rendered="#{BugDetailBean.isBugProjectDeveloper}">
                    <h:selectOneMenu id="Importance" value="#{BugDetailBean.importanceId}">
                        <f:selectItems value="#{BugDetailBean.importances}" />
                    </h:selectOneMenu>
                </h:panelGroup>

                <h:outputText value="#{msg.bug_status}:"/>
                <h:panelGroup rendered="#{!BugDetailBean.isBugProjectDeveloper}">
                    <h:outputText value="#{BugDetailBean.bug.status.name}"/>
                </h:panelGroup>
                <h:panelGroup rendered="#{BugDetailBean.isBugProjectDeveloper}">
                    <h:selectOneMenu id="Status" value="#{BugDetailBean.statusId}">
                        <f:selectItems value="#{BugDetailBean.statuses}" />
                    </h:selectOneMenu>
                </h:panelGroup>
            </h:panelGrid>

            
            <h:outputText value="#{msg.bug_detail}:"/><br/>
            <p class="outputtextarea"><h:outputText value="#{BugDetailBean.bug.summary}"/></p>
            <h:panelGrid>
            <h:inputHidden id="id" value="#{BugDetailBean.bug.id}"/>
            <h:message for="id" infoClass="message_info"/>

            <h:panelGroup rendered="#{BugDetailBean.isBugProjectDeveloper}">
                <h:commandButton action="#{BugDetailBean.updateBug}" value="#{msg.bugDetail_updateBug}"/>
            </h:panelGroup>
            </h:panelGrid>
    </a4j:form>


    <%-- Comments --%>

    <a4j:form ajaxSubmit="true" reRender="CommentPanel" id="Comment" prependId="">
        <a4j:outputPanel ajaxRendered="true" id="CommentPanel">

        <h:panelGroup rendered="#{BugDetailBean.isAnyComment}">
            <h3><h:outputText value="#{msg.comment_title}"/></h3>
            <rich:dataOrderedList var="comment" value="#{BugDetailBean.comments}">
                <h:outputText value="#{comment.creationTime} #{msg.comment_by} "/>
                <h:outputText value="#{comment.author.nick}"/><br/>
                <p class="outputtextarea"><h:outputText value="#{comment.text} " /></p>
            </rich:dataOrderedList>
        </h:panelGroup>

        <h:panelGroup rendered="#{ApplicationBean.isUser}">
        <h3><h:outputText value="#{msg.addComment_title}"/></h3>
        <h:panelGrid>
            <h:inputTextarea id="Text" value="#{BugDetailBean.comment.text}"
                             rows="8" cols="45" required="true" >
                <f:validateLength minimum="4"/>
            </h:inputTextarea>
            <h:message for="Text" errorClass="message_error"/>

        <h:inputHidden id="id2" value="#{BugDetailBean.bug.id}"/>
        
        <h:message for="id2" infoClass="message_info"/>
        <a4j:commandButton action="#{BugDetailBean.addComment}" value="#{msg.addComment_button}"/>
        </h:panelGrid>
        </h:panelGroup>

        <h:panelGroup rendered="#{!ApplicationBean.isUser}">
            <br/>
            <h:outputText styleClass="message_info" value="#{msg.addComment_login_message}"/>
        </h:panelGroup>

        </a4j:outputPanel>
    </a4j:form>

    <%--TODO v0.2 for Ediczech: strankovani komentaru--%>

    <%-- Content --%>

    <%@include file="view/footer.jsp" %>
</f:view>